<?php
	require_once("../conexion/conexion.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Formulario Busqueda</title>
<link href="../Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />

<script src="../include_js/jquery.js" type="text/javascript"></script>

<script>
$(document).ready(function()
{
    $.ajax({
            type: 'POST',
            url: 'Carga_busqueda_Inventario.php',
            data: $('#form_inventario').serialize(),
            success: function(data) {
                $('#mensaje').html(data);
            }
        })
});

function CargaDatos()
{
	valor = document.getElementById('cmb_Area').value;
	if(valor==0)
	{
		$.ajax({
				type: 'POST',
				url: 'Carga_busqueda_Inventario.php',
				data: $('#form_inventario').serialize(),
				success: function(data) {
					$('#mensaje').html(data);
				}
			})
	}
	else
	{
		$.ajax({
				type: 'POST',
				url: 'Carga_busqueda_Inventario_Area.php',
				data: $('#form_inventario').serialize(),
				success: function(data) {
					$('#mensaje').html(data);
				}
			})
	}
}
</script>

</head>

<body>
<form name="form_inventario" id="form_inventario" method="post">
<table width="100%" border="0" cellpadding="0">
  <tr>
    <td>
	<div class='option2'><label style="font:Verdana, Arial, Helvetica, sans-serif; color:#0066CC; font-weight:bold;">Filtros para Generar Inventario.</label></div>
	<div class='groupbox'>
	<div id="capa" style="z-index:1;"></div>
	<table width="100%" border="0" class="tres" cellpadding="0" cellspacing="0">
  <tr style="border:1px solid #6593C0;">
    <td style="border:1px solid #6593C0;"><label style="color:#FFFFFF; font-weight:bold;">Productos</label></td>
    <td style="border:1px solid #6593C0;"><label style="color:#FFFFFF; font-weight:bold;">Fecha Desde</label></td>
    <td style="border:1px solid #6593C0;"><label style="color:#FFFFFF; font-weight:bold;">Fecha Hasta</label></td>
    <td style="border:1px solid #6593C0;">&nbsp;</td>
  </tr>
  <tr style="border:1px solid #6593C0;">
    <td width="247" style="border:1px solid #6593C0;">
	<select name="cmb_Producto" id="cmb_Producto">
	<option value="0">--SELECCIONE--</option>
	<?php
				$con = new Conexion();
        		$con2 = $con->conexionBD("fpproduccion");
                $sql = "select b.ProCod,ProNombre from bodegacentral b 
								inner join producto p on 
								p.ProCod=b.ProCod";
                $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				while ($row = mysql_fetch_row($resultado))
				{
					echo "<option value='".$row[0]."'>".$row[1]."</option>";
				}
                $con->cerrarBD();
                
	?>
    </select>    </td>
    <td width="161" style="border:1px solid #6593C0;"><input name="txtFIni" type="text" id="txtFIni" size="10">&nbsp;<img src="../imagen/img.gif" width="20" height="14" title="calendario" style="cursor: pointer; border: 1px solid green;" onmouseover="this.style.background='black';" onmouseout="this.style.background=''" onclick="popUpCalendar(txtFIni, form_inventario.txtFIni, 'dd-mm-yyyy');" /></td>
    <td width="435" style="border:1px solid #6593C0;"><input name="txtFFin" type="text" id="txtFFin" size="10">&nbsp;<img src="../imagen/img.gif" width="20" height="14" title="calendario" style="cursor: pointer; border: 1px solid green;" onmouseover="this.style.background='black';" onmouseout="this.style.background=''" onclick="popUpCalendar(txtFFin, form_inventario.txtFFin, 'dd-mm-yyyy');" /></td>
    <td width="128" style="border:1px solid #6593C0;"><input name="btn_Buscar" id="btn_Buscar" type="button" value=" " class="buscar" onclick="CargaDatos();" /></td>
  </tr>
  <tr style="border:1px solid #6593C0;">
    <td style="border:1px solid #6593C0;"><label style="color:#FFFFFF; font-weight:bold;">Area</label></td>
    <td style="border:1px solid #6593C0;">&nbsp;</td>
    <td style="border:1px solid #6593C0;">&nbsp;</td>
    <td style="border:1px solid #6593C0;">&nbsp;</td>
  </tr>
  <tr style="border:1px solid #6593C0;">
    <td style="border:1px solid #6593C0;" colspan="4"><select name="cmb_Area" id="cmb_Area">
	<option value="0">BODEGA CENTRAL</option>
	<?php
				$con = new Conexion();
        		$con2 = $con->conexionBD("fpproduccion");
                $sql = "select ACod,ANombre from area";
                $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				while ($row = mysql_fetch_row($resultado))
				{
					echo "<option value='".$row[0]."'>".$row[1]."</option>";
				}
                $con->cerrarBD();
	?>
    </select></td>
  </tr>
</table>		
      </div></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td><div id="mensaje"></div></td></tr>
</table>
</form>
</body>
</html>